Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

199
Visualizações
How does Chrome determine the input[type="date"] format?

My browser's navigator.language is en-US, system (macos) primary language is English (United States). When I do new Date().toLocaleDateString() in chrome console I got 10/27/2021 which is as expected. The weird thing is for a simple HTML <input type="date" value="2021-10-27" /> It shows up in my Chrome as 27/10/2021. I've searched up and down and couldn't figure out what caused Chrome to format date input this way. Any ideas?

chrome input date format for 2021-10-27

For comparison, in safari (navigator.language = "en-us") on the same computer, it shows up as 10/27/2021 as expected.

safari input date format for 2021-10-27

For quick reproduction, here's a code sandbox link which you can view in chrome & safari: https://codesandbox.io/s/youthful-moon-oiryd?file=/index.html:119-159

<input type="date" value="2021-10-27">

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Turned out it was because my macOS had its region set to Singapore, despite primary language set to English (US). After I updated the Region to be United States the date in the input changed to mm/dd/yyyy. I suppose this means Chrome picks up the system region for locale and it takes priority over the language settings. Funny that Chrome only does this for date input formatting but not for its implementation of toLocaleDateString – perhaps two different teams for DOM vs javascript implementation. Anyway, leaving this here in case it may help someone else.

macos language & regions setting

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda